import React, { Component } from 'react'
import { Accordion, List } from 'antd-mobile';
import '../assets/style/publishPage_c.less';

import Header from '../components/IndexHeader_c';
import Room from '../components/Room_c';

export default class PublishPage extends Component {

    state = {
        title1: "二手房出售",
        title2: "审核状态"
    }

    onChange = (key) => {
        console.log(key);
    }
    headleClick2 = (typeName, e) => {
        this.setState({
            [typeName]: e.target.innerText
        })
    }
    handleClick = () => {
        this.props.history.go(-1)
    }
    render() {
        return (
            <div>
                <Header onClick={this.handleClick}>我的发布</Header>
                <Accordion defaultActiveKey="0" className="my-accordion" onChange={this.onChange}>
                    <Accordion.Panel header={this.state.title1}>
                        <List className="my-list1">
                            <List.Item onClick={(e) => { this.headleClick2('title1', e) }}>二手房出售</List.Item>
                            <List.Item onClick={(e) => { this.headleClick2('title1', e) }}>出租房</List.Item>
                            <List.Item onClick={(e) => { this.headleClick2('title1', e) }}>求购</List.Item>
                            <List.Item onClick={(e) => { this.headleClick2('title1', e) }}>求租</List.Item>
                        </List>
                    </Accordion.Panel>
                    <Accordion.Panel header={this.state.title2}>
                        <List className="my-list2">
                            <List.Item onClick={(e) => { this.headleClick2('title2', e) }}>通过</List.Item>
                            <List.Item onClick={(e) => { this.headleClick2('title2', e) }}>不通过</List.Item>
                            <List.Item onClick={(e) => { this.headleClick2('title2', e) }}>审核中</List.Item>
                        </List>
                    </Accordion.Panel>
                </Accordion>
                <div className="body">
                    <Room list={[
                        {
                            title: "石景山",
                            src: "room.png",
                            size: "43平/2室 1厅 / 远洋新天地",
                            prise: "2000/月",
                            tag: ['小区', '楼房']
                        }
                    ]}
                    ></Room>
                </div>
            </div>
        )
    }
}
